#ifndef TIMERSERVICE_H
#define TIMERSERVICE_H

#include <head/g_functionbase.h>
#include <element/baseudpreceiver.h>
#include <QtService>
#include "m_fhs.h"

class TimerService : public QObject
{
    Q_OBJECT
public:
    explicit TimerService(QObject *parent = nullptr);

    void start();
    void stop();

    void updateTask();
    void killAllTimer();
    void processTask(const QString &prefix);

    void setTaskStruct(const QString &uid,
                       const QString &key,
                       QVariant value);

    void appendLog(const QString &event);

protected:
    void timerEvent(QTimerEvent *event);

private:
    int syncTimerId;
    QMap<QString,QString> taskMap;  //uid,path
    QMap<int,QString> timerMap;     //timerId,uid
};

#endif // TIMERSERVICE_H
